<div class="title">
	<span>Products</span>
	<a href="<?php echo site_url('admin/add_product');?>" class="ibtn add">Add Product</a>
	<div class="clear">&nbsp;</div>
</div>


<?php flash();?>
<?php
if(!empty($products)){
	$tmpl = array ( 'table_open'  => '<table border="1" cellpadding="2" cellspacing="1" class="tbl-list" id="tbl-list">' );
	$this->table->set_heading('Image', 'Name', 'Description', 'Price', 'Qty','Featured', 'Action');
	$this->table->set_template($tmpl);
	
	foreach($products as $v){
		if($v->featured != 'yes')
			$link = '<a href="'.site_url('admin/set_featured/'.$v->id).'" class="btn-icon featured" title="Set product as featured">Featured</a>';
		else
			$link = '<a href="'.site_url('admin/unset_featured/'.$v->id).'" class="btn-icon unfeature" title="Unset product as featured">Undo Featured</a>';
		$data = array(
				'<img src="'.site_url().'/'.$v->image.'" width="50px" height="50px"/>',
				$v->name,
				$v->description,
				$v->price,
				$v->quantity,
				$v->featured == 'yes' ? ucfirst($v->featured):'',
				'<a href="'.site_url('admin/delete/products/'.$v->id).'" class="btn-icon delete" title="Delete">Delete</a>
				<a href="'.site_url('admin/edit_product/'.$v->id).'" class="btn-icon edit" title="Edit">Edit</a>'

		);
		$this->table->add_row($data);	
	}
	echo $this->table->generate();
}
else {
		echo '<div class="msg notice"><span></span><h5>Notice</h5>No products available yet.</div>';	
	}
?>